<!--[if IE 6]> 
<script type="text/javascript" src="./../script/plugins/fixpng/DD_belatedPNG_0.0.8a.js"></script>
<script>
function fixPngFun(){
	DD_belatedPNG.fix('.flow_arrow,.flow_normal,.arrow_image');
}
</script>
<![endif]--> 
<script language="JavaScript">
	$(document).ready(function() {
		$(".flow_normal").mouseover(function(event){
			$(this).css('background-image','url(./../theme/default/images/main/process/flow_over.png)');
		});
		$(".flow_normal").mouseout(function(event){
			$(this).css('background-image','');
		});
		$(".flow_normal").mousedown(function(event){
			$(this).css('background-image','url(./../theme/default/images/main/process/flow_down.png)');
			//重复点击
			if($(downFlowNode).attr("id") == $(this).attr("id")){
				return;
			}
			if(downFlowNode !=null){
				$(downFlowNode).css('background-image','');
				$(".flow_normal").mouseover(function(event){
					$(this).css('background','url(./../theme/default/images/main/process/flow_over.png)');
				});
				$(".flow_normal").mouseout(function(event){
					$(this).css('background','');
				});
			}
			downFlowNode = $(this);
			$(this).unbind("mouseout");
			$(this).unbind("mouseover");
		});
		
		if($('#rootId').val()!='') {
    		id = $('#rootId').val();
    		refreshBatchFunctions();
    	} else if($('#processNodeId').val()!='') {
    		id = $('#processNodeId').val();
    		refreshBatchFunctions(id);
    		// 预先选中
    		if($('#node'+id).attr('class')=='flow_normal') {
    			$('#node'+id).css('background-image','url(./../theme/default/images/main/process/flow_down.png)');
    		} 
    		downFlowNode = $('#node'+id);
    		$('#node'+id).unbind("mouseout");
			$('#node'+id).unbind("mouseover");
    	}
    	
	});
	function searchByAllProcessNodes(id) {
		$('#rootId').val(id);
		$('#processNodeId').val('');
		searchByStatus();
		refreshBatchFunctions();
	}
	function searchByProcessNode(id) {
		$('#processNodeId').val(id);
		searchByStatus();
		refreshBatchFunctions(id);
	}
	function searchByStatus() {
		$('#GridTable').datagrid("options").url=TDQS.CONTEXT_PATH+'business/list.action?tdqssid='+TDQS.SESSION_ID;
		$('#GridTable').datagrid("tdqsLoad",$.extend(getFormParams('hiddenForm'),getFormParams('searchForm')));
	}
	function refreshBatchFunctions(status) {
		if(!status) {
			status = '';
		}
		$.tdqsAjax({
			type: "post",
			dataType: "json",
			url: TDQS.CONTEXT_PATH+'business/getBatchFunctions?tdqssid='+TDQS.SESSION_ID+'&list.id='+$('#listId').val()+'&businessProcess.id='+$('#businessProcessId').val()+'&businessInstance.processNode.id='+status,
			data : $('#hiddenForm').serialize(),
			success:function(json) {
				$('.functionGroup').remove();
				if(json.data){
					var html = '';
					for(var i=json.data.length-1;i>=0;i--) {
						var func = json.data[i];
						if(func) {
							if(func.url) {
								html += "<li class=\""+func.icon+"\" style=\"cursor:pointer;\" onclick=\"javascript:showUrl('"+func.url+"');return false;\"><a href=\"javascript:void(0)\"><img src=\"./../theme/default/images/main/blank.gif\" style=\"float:left;clear:left\"><div style=\"line-height:20px;line-height:23px\\9;float:left;cursor:pointer\"><span style=\"cursor:pointer\">"+func.displayName+"</span></div></a></li>";
							} else {
								if(func.isFunctionGroup && func.isFunctionGroup=="1") {
									html += "<li class=\""+func.icon+"\" style=\"cursor:pointer;border-right:1px solid #edfbfe;border-left:1px solid #edfbfe\" onmouseover=\"javascript:showFunctionGroup(this,$('a div span',this),'"+func.id+"',event);return false;\"><a href=\"javascript:void(0)\"><img src=\"./../theme/default/images/main/blank.gif\" style=\"float:left;clear:left\"><div style=\"line-height:20px;line-height:23px\\9;float:left;cursor:pointer\"><span style=\"cursor:pointer\">"+func.displayName+"</span></div></a></li>";
									html += "<div id=\"div"+func.id+"\" class=\"functionGroup\" style=\"display:none;position:relative;float:left;clear:left\">"
		              html += "<ul style=\"list-style:none;line-height:25px;\">";        	
						      for(var j=json.data.length-1;j>=0;j--) {
										var childFunc = json.data[j];
										if(childFunc && childFunc.parentFunction && childFunc.parentFunction.id && childFunc.parentFunction.id==func.id) {
						             html += "<li class=\""+childFunc.icon+"\" style=\"cursor:pointer;margin: 0px;padding: 0px;\" onmouseover=\"processOver(this);\" onmouseout=\"processOut(this);\" onclick=\"javascript:processCommonFunc('"+childFunc.id+"','"+(childFunc.isBatch?childFunc.isBatch:"0")+"','"+(childFunc.messageType?childFunc.messageType:"0")+"','"+(childFunc.message?childFunc.message:"")+"','"+(childFunc.forwardType?childFunc.forwardType:"")+"','"+(childFunc.clearSession?childFunc.clearSession:"0")+"','"+(childFunc.isPassParams?childFunc.isPassParams:"0")+"');return false;\"><a href=\"javascript:void(0)\"><span style=\"cursor:pointer;margin-left:10px\">"+childFunc.displayName+"</span></a></li>";
						      	}
						      }
	                            		
	                html += "</ul>";
	                html += "</div>";
	                
								} else if(!func.parentFunction){
									html += "<li class=\""+func.icon+"\" style=\"cursor:pointer\" onclick=\"javascript:processCommonFunc('"+func.id+"','"+(func.isBatch?func.isBatch:"0")+"','"+(func.messageType?func.messageType:"0")+"','"+(func.message?func.message:"")+"','"+(func.forwardType?func.forwardType:"")+"','"+(func.clearSession?func.clearSession:"0")+"','"+(func.isPassParams?func.isPassParams:"0")+"');return false;\"><a href=\"javascript:void(0)\"><img src=\"./../theme/default/images/main/blank.gif\" style=\"float:left;clear:left\"><div style=\"line-height:20px;line-height:23px;float:left;cursor:pointer;\"><span style=\"cursor:pointer\">"+func.displayName+"</span></div></a></li>";
								}
							}
							
						}
					}
					$('#mainButton').html(html);
					try{
					if(typeof(eval(displayBagDiv))=="function"){
						displayBagDiv();
					}
					}catch(e){
				      
				    }  

					
				}
			}
		});
	}
var downFlowNode;
var downFlowNodeStatus;
</script>
<div id="statusDiv">
<div>
<input type="hidden" name="filterMap['businessInstance.businessProcess.id'].filterValue" ${"<#if filterMap["}"businessInstance.businessProcess.id"${"]??>"} value='${"${"}filterMap["businessInstance.businessProcess.id"].filterValue?default('')${"}"}' ${"</#if>"} id="rootId"/>
<input type="hidden"  name="filterMap['businessInstance.businessProcess.id'].filterName" value="businessInstance.businessProcess.id" />
<input type="hidden"  name="filterMap['businessInstance.businessProcess.id'].expType" value="eq" />

<input type="hidden" name="filterMap['businessInstance.processNode.id'].filterValue" ${"<#if filterMap["}"businessInstance.processNode.id"${"]??>"} value='${"${"}filterMap["businessInstance.processNode.id"].filterValue?default('')${"}"}' ${"</#if>"} id="processNodeId"/>
<input type="hidden"  name="filterMap['businessInstance.processNode.id'].filterName" value="businessInstance.processNode.id" />
<input type="hidden"  name="filterMap['businessInstance.processNode.id'].expType" value="eq" />
</div>
<#if process_node_list?? && process_node_list?size gt 0>
<#list process_node_list as rootNode>
	<div style="position:absolute;">
	<div class="flow_normal" style="height:26px;line-height:28px;_height:19px;_padding-top:7px;_line-height:14px;font-size:12px;font-weight:bold;color:#FFFFFF;cursor:pointer;text-align:center;float:left;clear:left;padding-right:10px;padding-left:10px;position:relative" onclick="searchByAllProcessNodes('${rootNode.id}');">全部</div>
	<#if rootNode.nodes?? && rootNode.nodes?size gt 0>
	<#assign index=1>
	<#list rootNode.nodes as node>
		<#if node_has_next>
			<div id="node${node.id}" class="flow_normal" onclick="searchByProcessNode('${node.id}')" class="flowBlock" style="height:26px;line-height:27px;*line-height:26px;font-size:12px;font-weight:bold;color:#FFFFFF;cursor:pointer;text-align:center;padding-right:10px;padding-left:10px;float:left;position:relative">
				${index}. ${node.name}
			</div>
			<div style="width:14px;height:25px;margin-right:2px;margin-left:2px;border-right:1px solid #80c8d7;float:left;position:relative">
				<div style="position:relative;top:10px"><img class="arrow_image" style="width:4px;height:7px" src="./../theme/default/images/main/process/arrow.png"/></div>
			</div>
		</#if>
		<#if !node_has_next>
			<div id="node${node.id}" class="flow_normal" onclick="searchByProcessNode('${node.id}')" class="flowBlock" style="height:26px;line-height:27px;*line-height:26px;font-size:12px;font-weight:bold;color:#FFFFFF;cursor:pointer;text-align:center;padding-right:10px;padding-left:10px;float:left;position:relative">
				${index}. ${node.name}
			</div>
		</#if>
		<#assign index=index+1>
	</#list>
	</#if>
	</div>
</#list>
</#if>
</div>
